package ehcache;

import java.util.HashMap;
import java.util.Map;

import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Element;

public class TestXX {

	public static void main(String[] args) {
		CacheManager manager = new CacheManager();
		Cache cache = manager.getCache("online-users");

		for (int i = 0; i < 50000; i++) {
			Element element = new Element("key" + i, "aa"+i);
			cache.put(element);
		}
		
//		Element element = new Element("key" , "aa");
//		cache.put(element);

		System.out.println(cache.getKeys().size());
		
//		for (Object key : cache.getKeys()) {
//			String aa= (String) cache.get(key).getObjectValue();
//			System.out.println(aa);
//		}
//
//		for (Object key : cache.getKeys()) {
//			Map<String, UserInfo> map=(Map<String, UserInfo>) cache.get(key).getObjectValue();
//			System.out.println(map.size());
//		}

	}
	
	private static Map<String, UserInfo> getMap(int i){
		Map<String, UserInfo> userInfoMap=new HashMap<String, UserInfo>();
		for(int k=0;k<10;k++){
			userInfoMap.put(k+"aa"+i, new UserInfo(k));
		}
		return userInfoMap;
	}
}
